package com.demo.jdbc.d_c3p0;

import com.demo.jdbc.a_domain.User;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

public class TestC3P0 {
    
    @Test
    public void demo1(){
    
        String xmlPath = "com/demo/jdbc/d_c3p0/beans.xml";
        ApplicationContext applicationContext=new ClassPathXmlApplicationContext(xmlPath);
        UserDao userDao = (UserDao) applicationContext.getBean("userDaoId");
        
        List<User> allUser=userDao.findAll();
        for (User user : allUser) {
            System.out.println(user);
        }
    
    }
}
